// 组合form对象
function combinationFormObject(form) {
  var formObject = {};
  if (form != null) {
    var name = "";
    var value = "";
    for (var i = 0, len = form.length; i < len; i++) {
      name = form[i].name;
      value = form[i].value;
      if (name != null && name != "") {
        formObject[name] = value;
      }
    }
  }
  return formObject;
}

/*日期格式转换*/
function formatData(dateLong,format) {
  if (dateLong != null) {
    var date = new Date(dateLong);
    var month = date.getMonth() + 1;
    var day = date.getDate();
    if (format == null || format == "yyyy-MM-dd") {
      return date.getFullYear() + "-" + (month < 10 ? ("0" + month) : month)  + "-" + (day < 10 ? ("0" + day) : day);
    } else {
      var hours = date.getHours();
      var minutes = date.getMinutes();
      var seconds = date.getSeconds();
      return date.getFullYear() + "-" + (month < 10 ? ("0" + month) : month)  + "-" + (day < 10 ? ("0" + day) : day)
        + " " + (hours < 10 ? ("0" + hours) : hours) + ":" + (minutes < 10 ? ("0" + minutes) : minutes) + ":" + (seconds < 10 ? ("0" + seconds) : seconds);
    }
  }
}
